package com.advaita.gui;

import java.awt.*;
import javax.swing.*;

import com.advaita.license.Customer;
import com.advaita.license.Selection;
import com.advaita.util.*;

public class Microarray extends JPanel {
	
	Microarray (Customer customer) {
       
   		setLayout (new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();

		SetupComboBox setupComboBox = new SetupComboBox();
		Object[] items1 = new ComboItem[18];

		Object[] items2 = { new ComboItem("[Hu35ksubC] Affymetrix Human 35K SubC Array 03/11/2002"), 
				new ComboItem("[Hu35KsubD] Affymetrix Human 35K SubD Array 03/11/2002"),
				new ComboItem("[U133_X3P] Affymetrix Human X3P Array 07/20/2004", false), 
				new ComboItem("[HG_U95c] Affymetrix Human Genome U95C Array03/11/2002", true) };

		int index = 0;
		for (Selection microArrayIterator : customer.licenseInfo
				.getMicroArray()) {
		//	System.out.println("MicroArray : "
		//			+ microArrayIterator.getSelection() + "  ( "
		//			+ microArrayIterator.getIsEnabled() + " )"+index);
			items1[index]=new ComboItem(microArrayIterator.getSelection() ,
					                    microArrayIterator.getIsEnabled());
			index ++;
		}
		index = 0;
		
			
		JComboBox combo = new JComboBox(items1);
		combo.setRenderer(new ComboRenderer());
		combo.addActionListener(new ComboListener(combo));

		JComboBox combo2 = new JComboBox(items2);
		combo2.setRenderer(new ComboRenderer());
		combo2.addActionListener(new ComboListener(combo2));
		
		JLabelAllinOne spacer = new JLabelAllinOne(" ", "Serif", Font.PLAIN, 15);
		c.gridx = 0;
		c.gridy = 0;
		c.weightx=1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.anchor = GridBagConstraints.FIRST_LINE_START;
		add(spacer,c);

		JLabelAllinOne label1 = new JLabelAllinOne("Manufacturer    ", "Serif", Font.PLAIN, 15);
		c.gridx = 0;
		c.gridy = 1;
		c.weightx=1;
		c.fill = GridBagConstraints.HORIZONTAL;
		c.anchor = GridBagConstraints.FIRST_LINE_START;
		add(label1,c);
		c.gridx = 1;
		c.gridy = 1;		
		add(combo,c);
		
		JLabelAllinOne label2 = new JLabelAllinOne("Array         ", "Serif", Font.PLAIN, 15);
		c.gridx = 0;
		c.gridy = 2;
		add(label2,c);
		c.gridx = 1;
		c.gridy = 2;		
		add(combo2,c);
		
	} // end of constructor

}
